import sys
sys.path.append("..")
import numpy as np
from common.util import preprocess, create_co_matrix, most_similar,ppmi

if __name__=="__main__":
    text = 'You say goodbye and I say hello.'
    corpus, word_to_id, id_to_word = preprocess(text)
    vocab_size = len(word_to_id)
    # 输出共现矩阵
    C = create_co_matrix(corpus, vocab_size)
    W  = ppmi(C)

    np.set_printoptions(precision=3) # 有效位数为3
    print('covariance matrix')
    print(C)
    print("-"*50)
    print("PPMI")
    print(W)

